<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.mao.model.user.User"%>
<%@page import="com.mao.util.SessionHelper"%>
<%@ page language="java" pageEncoding="UTF-8"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>运通在线服务</title>
<%@ include file="/WEB-INF/pages/common/frameCommonJs.jsp"  %>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/layout.css" />
<link href="<%=request.getContextPath()%>/css/welcome/welcome.css" type="text/css" rel="stylesheet" />
<style type="text/css">
body {
	font: 12px/20px "微软雅黑", "宋体", Arial, sans-serif, Verdana, Tahoma;
	padding: 0;
	margin: 0;
} 
a:link {
 color:#000000;
 text-decoration: none;
}
a:visited {
 text-decoration: none;
}
a:hover {
 text-decoration: underline;
}
a:active {
 text-decoration: none;
}
.cs-north {
	height:70px;background:#B3DFDA;
}
.cs-north-bg {
	width: 100%;
	height: 100%;
	background: url('<%=request.getContextPath()%>/css/themes/gray/images/header_bg.png') repeat-x;
}
.cs-north-logo {
	float:left;
	width:160px;
	padding: 5px 0px 0px 20px;
}
.cs-north-title {
	float:left;	
	padding:30px 0px 0px 0px;
	color:#fff;font-size:22px;font-weight:bold;text-decoration:none
}
.cs-north-user {
	float:right;
	width:400px;
	padding: 10px 0px 0px 0px;
}
.cs-west {
	width:200px;padding:0px;border-left:1px solid #99BBE8;
}
.cs-south {
	height:25px;background:url('<%=request.getContextPath()%>/css/themes/gray/images/panel_title.gif') repeat-x;padding:0px;text-align:center;
}
.cs-navi-tab {
	padding: 5px;
}
.cs-tab-menu {
	width:120px;
}
.cs-home-remark {
	padding: 10px;
}
.dataGrid8 {
width: 60%;
overflow: hidden;
margin: 10px auto 0px auto;
}
.blue1Font {
color: #0189DF;
font-size: 14px;
}
.selected {
border: 1px solid #99BBE8;
background: #E0ECFF;
cursor: default;
}
</style>
	<script>
		function addTab(title, url, icon){  
	        if ($('#tabs').tabs('exists', title)){  
	            $('#tabs').tabs('select', title);  
	        } else {  
	            var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';  
	            $('#tabs').tabs('add',{  
	                title:title,
	                content:content,
	                closable:true,
	                iconCls:icon
	            });  
	        }  
    	}  
    	function addTabDirect(title, url,icon){  
          var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';  
	          $('#tabs').tabs('add',{  
	              title:title,  
	              content:content,  
	              closable:true,
	              iconCls:icon
	          });  
    	}  
    	function tabs(i){
			for(var j=1;j<=3;j++){
				if(j==i){
					document.getElementById('t'+j).style.backgroundColor = '#0000ff';
				}else{
					document.getElementById('t'+j).style.background = 'none';
				}
			}
		}
		function createTabContent(url){
    		return '<iframe style="width:100%;height:100%;" scrolling="auto" frameborder="0" src="' + url + '"></iframe>';
		}
		$(function(){
			/*为选项卡绑定右键*/
		    $(".tabs li").live('contextmenu',function(e){
		        
		        /* 选中当前触发事件的选项卡 */
		        var subtitle =$(this).text();
		        $('#tabs').tabs('select',subtitle);
		        
		        //显示快捷菜单
		        $('#menu').menu('show', {
		            left: e.pageX,
		            top: e.pageY
		        });
		        
		        return false;
		    });
		    /*双击关闭标签*/
		    $(".tabs li").live("dblclick",function(){
  				var currTab = $('#tabs').tabs('getSelected');
		        currTitle = currTab.panel('options').title; 
		        if(currTitle != "欢迎界面"){   
		        	$('#tabs').tabs('close', currTitle);
		        }
			});
		    //刷新
		    $("#m-refresh").click(function(){
		        var currTab = $('#tabs').tabs('getSelected');    //获取选中的标签项
		        var url = $(currTab.panel('options').content).attr('src');    //获取该选项卡中内容标签（iframe）的 src 属性
		        /* 重新设置该标签 */
		        $('#tabs').tabs('update',{
		            tab:currTab,
		            options:{
		                content: createTabContent(url)
		            }
		        })
		    });
		    //关闭所有
		    $("#m-closeall").click(function(){
		        $(".tabs li").each(function(i, n){
		            var title = $(n).text();
		            if(title != "欢迎界面"){
		            	$('#tabs').tabs('close',title);  
		            }
		        });
		    });
		    
		    //除当前之外关闭所有
		    $("#m-closeother").click(function(){
		        var currTab = $('#tabs').tabs('getSelected');
		        currTitle = currTab.panel('options').title;    
		        $(".tabs li").each(function(i, n){
		            var title = $(n).text();
		            if(currTitle != title){
		            	if(title != "欢迎界面"){
		                	$('#tabs').tabs('close',title);            
		                }
		            }
		        });
		    });
		    
		    //关闭当前
		    $("#m-close").click(function(){
		        var currTab = $('#tabs').tabs('getSelected');
		        currTitle = currTab.panel('options').title; 
		        if(currTitle != "欢迎界面"){   
		        	$('#tabs').tabs('close', currTitle);
		        }
		    });
			$('#tt1').tree({
				onClick:function(node){
					$('#tt1').tree('expand',node.target);
				}
			});
		});
		function newVoucher(name,url,icon){
			$("#m-close").click();
			addTabDirect(name,url,icon);
		}
		function selectAccord(title){
			$('.easyui-accordion').accordion('select',title);	
		}
	</script>
</head>
<% User user = SessionHelper.getSessionUser(); %>
<body class="easyui-layout">
	<div region="north" border="true" class="cs-north">
		<div class="cs-north-bg">
			<div class="cs-north-logo"><img src="<%=request.getContextPath()%>/images/logo.png" /></div>
			<div class="cs-north-title">运通在线服务</div>	
			<div class="cs-north-user">
			<table border="0" width="100%">
				<tr>
					<td>
						您好， <strong><%=SessionHelper.getSessionUser().getName() %></strong>&nbsp;(<%  if(user.getIsAdmin() == 2){ %>管理员<%} %><%  if(user.getIsAdmin() == 1){ %>店长<%} %><%  if(user.getIsAdmin() == 0){ %>员工<%} %>) 
						| 门店：<em><%=user.getStore().getCompanyName()%></em>
						[ <a href="<%=request.getContextPath()%>/main!quit.action">退出</a> ]
					</td>
				</tr>
				<% if(user.getLoginTime()!=null){ %>
				<tr>
					<td>
						<% SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");%>
					    上次登录时间：<%=sdf.format(user.getLoginTime()) %>
					</td>
				</tr>
				 <%} %>
			</table>
			</div>
		</div>
	</div>
	<div region="west" split="true" title="导航菜单" style="width:190px;padding1:1px;overflow:hidden;">
		<%@ include file="/WEB-INF/pages/layout/menu.jsp"  %>
	</div>
	<div region="center" title="操作界面" style="overflow:hidden;">
		<div class="easyui-tabs" fit="true" border="false" id="tabs" style="width:700px;height:auto">
			<div title="欢迎界面" style="overflow:hidden;"> 
			<%@ include file="/WEB-INF/pages/layout/index.jsp"  %>
			</div>
		</div>
	</div>
	<div id="menu" class="easyui-menu" style="width:150px;">
	    <div id="m-refresh">刷新</div>
	    <div class="menu-sep"></div>
	    <div id="m-closeall">全部关闭</div>
	    <div id="m-closeother">关闭其他</div>
	    <div class="menu-sep"></div>
	    <div id="m-close">关闭</div>
	</div>
</body>
</html>